package com.szrt.java.day20161227.demo01;

import org.junit.Test;

public class RandomDemo {

	/**
	 * 首先把11个人都方进去
	 * 
	 * 随机 random  floor 取出来。
	 */
	@Test
	public void randomTest(){
		
		//1 
		String[] class1612 = new String[11];
		class1612[0] = "张泽谋";
		class1612[1] = "吴荣来";
		class1612[2] = "钟鹏";
		class1612[3] = "刘浩";
		class1612[4] = "谢文威";
		class1612[5] = "黄志杰";
		class1612[6] = "张志东";
		class1612[7] = "胡斌";
		class1612[8] = "陈皋";
		class1612[9] = "曾少华";
		class1612[10] = "林天杰";
		
		/*//随机数
		double ran = Math.random();
		//System.out.println(ran);
		double len = ran*class1612.length;
		System.out.println(len);
		
		//double aa = 0.977247493412439;
		
		double f = Math.floor(len);
		//double c = Math.ceil(aa);
		System.out.println(f);
		System.out.println(class1612[(int) f]);
		//System.out.println(c);
*/		
		
		for(int i=1;i<=100;i++){
			
			double ran = Math.random();
			double len = ran*class1612.length;
			double f = Math.floor(len);
			System.out.print((int)f+" ");
			System.out.println(class1612[(int) f]);
		}
		
	}
	
}
